# import pygame
import pygame
from pygame.locals import *

# main line of sight class
class Sight(object):
    "this is the aiming line rect"
    # constants
    RED = (255, 0, 0)
    SCREEN_SIZE = (640, 480)
    
    def __init__(self, get_surface, background_image):
        "supply surface data"
        self.start = (0, 0)
        self.end = (0, 0)
        self.surface = get_surface
        self.bg_image = background_image
        self.rect = pygame.draw.aaline(self.surface, self.RED, self.start, self.end)
                
    def check_and_draw(self, player_position, mouse_position):
        "takes current mouse position"
        self.start = player_position
        self.end = mouse_position
        self.rect = pygame.draw.aaline(self.surface, self.RED, self.start, self.end)
        return self.rect

    def clear(self):
        "clears the sight"
        self.surface_blit = self.surface.blit
        self.surface_blit(self.bg_image, self.rect, self.rect)
        pygame.display.flip()
        
